package cn.kgm.makeGodV2.relationship;

/**
 * @Version 1.8
 * @Author: Kappi
 * @Date: 2025-10-13 14:13
 * @Description: cn.kgm.makeGodV2.relationship.EmotionSystemDemo
 */

import cn.kgm.makeGodV2.emotion.PersonalityTrait;

import java.util.List;

/**
 * 完整可运行的情感系统测试
 */
public class EmotionSystemDemo {
    public static void main(String[] args) {
        // 创建情感系统
        EmotionSystem system = new EmotionSystem();

        // 注册角色（使用不同的性格）
        system.registerCharacter("韩立", new PersonalityTrait(60d, 80d, 50d, 40d, 70d));  // 谨慎小心
        system.registerCharacter("南宫婉", new PersonalityTrait(80d, 50d, 30d, 60d, 40d)); // 神秘自由
        system.registerCharacter("王蝉", new PersonalityTrait(30d, 60d, 80d, 20d, 80d));   // 睚眦必报
        system.registerCharacter("厉飞雨", new PersonalityTrait(50d, 80d, 70d, 70d, 30d)); // 忠诚可靠

        System.out.println("=== 初始关系状态 ===");
        system.displayBidirectionalRelationship("韩立", "南宫婉");
        system.displayBidirectionalRelationship("韩立", "王蝉");
        system.displayBidirectionalRelationship("韩立", "厉飞雨");

        // 模拟情感事件
        System.out.println("=== 模拟情感事件 ===");

        // 1. 韩立救助南宫婉（互相产生好感）
        system.processBidirectionalEvent("韩立", "南宫婉", 25, 30, "救命之恩");

        // 2. 王蝉攻击韩立（互相产生恶感）
        system.processBidirectionalEvent("韩立", "王蝉", -15, -10, "宗门冲突");

        // 3. 韩立反击王蝉（王蝉睚眦必报，仇恨加深）
        system.processBidirectionalEvent("韩立", "王蝉", -20, -25, "自卫反击");

        // 4. 厉飞雨帮助韩立（互相产生好感）
        system.processBidirectionalEvent("韩立", "厉飞雨", 20, 15, "同门相助");

        // 5. 韩立与南宫婉多次相遇（逐渐产生爱慕）
        for (int i = 0; i < 3; i++) {
            system.processBidirectionalEvent("韩立", "南宫婉", 8, 6, "多次相遇");
        }

        // 6. 王蝉阴谋败露（韩立对其更加厌恶）
        system.processEmotionEvent("韩立", "王蝉", -15, "发现阴谋");

        System.out.println("=== 最终关系状态 ===");
        system.displayBidirectionalRelationship("韩立", "南宫婉");
        system.displayBidirectionalRelationship("韩立", "王蝉");
        system.displayBidirectionalRelationship("韩立", "厉飞雨");

        // 显示所有关系
        system.displayAllRelationships("韩立");
        system.displayAllRelationships("王蝉");

        // 测试特定关系查询
        testRelationshipQueries(system);
    }

    private static void testRelationshipQueries(EmotionSystem system) {
        EmotionManager hanliManager = system.getEmotionManager("韩立");
        if (hanliManager != null) {
            List<UnidirectionalRelationship> friends = hanliManager.getRelationshipsByType(RelationshipType.FRIEND);
            List<UnidirectionalRelationship> enemies = hanliManager.getRelationshipsByType(RelationshipType.ENEMY);

            System.out.println("=== 韩立的朋友 ===");
            for (UnidirectionalRelationship friend : friends) {
                System.out.println("  " + friend);
            }

            System.out.println("=== 韩立的敌人 ===");
            for (UnidirectionalRelationship enemy : enemies) {
                System.out.println("  " + enemy);
            }
        }
    }
}
